<?php
namespace app\article\validate;
use think\Validate;
class Pick extends Validate {
    //验证字段
    protected $rule = [
        'article_id' => ['require'],
        'create_time' => ['require'],
        'creater' => ['require'],
        'update_time' => ['require'],
        'updater' => ['require'],
        'status' => ['require','number'],
        'ext1' => ['require'],
        'id' => ['require','number'],
    ];
    //返回消息
    protected $message = [
        'article_id.require' => '文章id必须',
        'create_time.require' => '创建时间必须',
        'creater.require' => '创建者必须',
        'update_time.require' => '更新时间必须',
        'updater.require' => '更新者必须',
        'status.require' => '当前数据状态值必须',
        'status.number' => '当前数据状态值不是数字',
        'ext1.require' => '预备字段1必须',
        'id.require' => 'id必须',
        'id.number' => 'id不是数字',
    ];

    // except_id 场景
    public function sceneExcept_id(){
        return $this->only(['article_id','create_time','creater','update_time','updater','status','ext1']);
    }

    // only_id 场景
    public function sceneOnly_id(){
        return $this->only(['id']);
    }

    // all_field 场景
    public function sceneAll_field(){
        return $this->only(['id','article_id','create_time','creater','update_time','updater','status','ext1']);
    }
}
